<?php
namespace Amis\dataviewer;

use Amis\Basics\AmisBasics;

class Log extends AmisBasics
{
    public string $type = 'log';

    /**
     * 展示区域高度
     * @param int $height
     * @return $this
     */
    public function height(int $height = 500)
    {
        $this->height = $height;
        return $this;
    }

    /**
     * 外层 CSS 类名
     * @param string $className
     * @return $this
     */
    public function className(string $className)
    {
        $this->className = $className;
        return $this;
    }

    /**
     * 是否自动滚动
     * @param bool $autoScroll
     * @return $this
     */
    public function autoScroll(bool $autoScroll = true)
    {
        $this->autoScroll = $autoScroll;
        return $this;
    }

    /**
     * 加载中的文字
     * @param string $placeholder
     * @return $this
     */
    public function placeholder(string $placeholder)
    {
        $this->placeholder = $placeholder;
        return $this;
    }

    /**
     * 返回内容的字符编码
     * @param string $encoding
     * @return $this
     */
    public function encoding(string $encoding = 'utf-8')
    {
        $this->encoding = $encoding;
        return $this;
    }

    /**
     * 接口
     * @param string $source
     * @return $this
     */
    public function source(string $source)
    {
        $this->source = $source;
        return $this;
    }

    /**
     * 设置每行高度，将会开启虚拟渲染
     * @param int $rowHeight
     * @return $this
     */
    public function rowHeight(int $rowHeight)
    {
        $this->rowHeight = $rowHeight;
        return $this;
    }

    /**
     * 最大显示行数
     * @param int $maxLength
     * @return $this
     */
    public function maxLength(int $maxLength)
    {
        $this->maxLength = $maxLength;
        return $this;
    }

    /**
     * 关闭 ANSI 颜色支持
     * @param bool $disableColor
     * @return $this
     */
    public function disableColor(bool $disableColor)
    {
        $this->disableColor = $disableColor;
        return $this;
    }
}